# -*- encoding=utf8 -*-
"""
RedFlag-TC00009101   （拍摄进入装饰页）剪辑倒放功能
使用倒放功能倒放视频场景
取消倒放场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *

auto_setup(__file__)
shooter = CameraVideoShooter()

log("--------------------------------使用倒放功能倒放视频场景--------------------------------------")
"""
拍摄进入装饰页
点击剪辑
点击倒放
断言
等待
断言
"""

shooter.enter_photography_decoration_page()
shooter.click_element(edit_button)
sleep(1.0)
shooter.click_element(edit_inverted)
shooter.assert_element_exists(edit_inverted_animation,"断言失败，预期倒放动画弹窗并未出现")
shooter.assert_image_exists(r"tpl1748261490552.png", "断言失败，并未发现倒放成功提示toast", record_pos=(-0.004, 0.752), resolution=(1224, 2700), threshold=0.9)


log("--------------------------------取消倒放视频场景--------------------------------------")
"""
点击倒放
断言
"""
shooter.click_element(edit_inverted)
shooter.assert_image_exists(r"tpl1748261472877.png", "断言失败，并未发现倒放成功提示toast", record_pos=(-0.004, 0.752), resolution=(1224, 2700), threshold=0.9)

# 关闭应用
stop_app(UGC_package_name)